import requests
import json
from globalsettings import CUR_MODE

if CUR_MODE == 'dev':
    from globalsettings_dev import *
else:
    from globalsettings_prod import *
log = Fralog().getFileLog()


def get_question(p_dict):
    st = json.dumps(p_dict)
    q = 'http://' + OCEAN_IP + ':8177/ques?user=ques&pwd=fract111&pstr=' + st
    b = requests.get(url=q).content
    return json.loads(b.decode())


if __name__ == '__main__':
    p_dict = {'O': 2, 'C': 0.1, 'E': 1, 'A': -2, 'N': 1}
    g = get_question(p_dict)
    print(g)
    # [{'content': '我不太喜欢明亮度中等的图片', 'id': 'r2196', 'type': 'feature'},
    # {'content': '我认为人活着就是要追求享乐，这样才不枉此生', 'id': 'b655', 'type': 'feature'},
    #  {'content': '我不会刻意在别人面前为自己营造良好的印象', 'id': 'r1192', 'type': 'feature'},
    #  {'content': '002', 'id': '002', 'type': 'picture'},
    #  {'content': '027', 'id': '027', 'type': 'picture'}]
